javax.naming.OperationNotSupportedException Context is read only

javax.naming.OperationNotSupportedException Context is read only

场景:

最近帮忙升级Tomcat版本时发现日志有这个异常:

1
javax.naming.OperationNotSupportedException: Context is read only

原因:

容器必须确保应用程序组件实例仅具有对其命名上下文的读访问权。
因此,修改环境命名上下文及其子上下文的javax.naming.Context接口的所有方法都会抛出该异常

The container must ensure that the application component instances have only read access to their naming context. The container must throw the javax.naming.OperationNotSupportedException from all the methods of the javax.naming.Context interface that modify the environment naming context and its subcontexts.


解决方案:

针对以上异常原因,我们可以修改Tomcat的conf下的context.xml配置文件,修改如下:

1
<Context jndiExceptionOnFailedWrite="false">

关注Github:1/2极客

关注博客:御前提笔小书童

关注网站:开发者的花花世界

关注公众号:开发者的花花世界


本作品采用知识共享署名 4.0 中国大陆许可协议进行许可,欢迎转载,但转载请注明来自御前提笔小书童,并保持转载后文章内容的完整。本人保留所有版权相关权利。

本文链接:https://royalscholar.cn/2020/12/11/javax.naming.OperationNotSupportedException Context is read only/

# JAVA

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×